

import bpy
import ctypes
from bpy.types import Panel, Menu

from global_data.global_enum import *
from 场景.场景资源管理 import bl_场景管理

import 场景.bl_ui_properties_scenePanel as ui_场景数据子面板





class SceneButtonsPanel:
	bl_space_type = 'PROPERTIES'
	bl_region_type = 'WINDOW'
	bl_context = "scene"





class C_场景添加删除操作面板(SceneButtonsPanel, Panel):
	bl_label = '场景添加删除'

	@classmethod
	def poll(cls, context):
		scene = context.scene
		#print('scene = ', scene)
		bl_场景管理.f_轮询场景(scene)
		
		return (scene.render.engine in COMPAT_ENGINES)
		
	def draw(self, context):
		layout = self.layout
		#layout.operator('scene.game_scene_add', text='添加场景', icon='SCENE_DATA')
		scene = context.scene
		layout.label(text='mbt:' + str(scene.m_场景ID))
		
		col = layout.column()
		#if scene.m_PhysX == False:
		#预先创建了Px引擎
		#col.operator('scene.add_physx', text='添加PhysX', icon='SCENE_DATA')
		#if scene.m_FleX == False:
		if scene.m_FleX == False :
			col.operator('scene.add_flex', text='添加FleX', icon='SCENE_DATA')
			row = layout.row()
			row.prop(context.scene, 'm_FleX_粒子数')
			row.prop(context.scene, 'm_FleX_飞溅数')
		else:
			col.operator('scene.remove_flex', text='移除FleX', icon='SCENE_DATA')


		layout.prop(scene, 'm_是否开场景更新', text='是否开场景更新')
		#layout.prop(scene, 'm_是否开启物理模拟', text='是否开启物理模拟')


		'''
		col = row.column()
		col.template_list("C_着色程序列表_UL_example", "", 
														bpy.data, "node_groups", 
														bpy.data.node_groups[0], 
														"active_output", rows=2, type='GRID') #
		col.template_ID_preview(bpy.data.node_groups.NodeTree, "C_ShaderNodeTree")'''





classes = (
	C_场景添加删除操作面板,
)




def register():
	bl_场景管理.register()
	ui_场景数据子面板.register()

	for c in classes:
		bpy.utils.register_class(c)
		

	#初始化
	#bl_场景管理.poll(bpy.context)
	#bl_场景管理.f_轮询场景(bpy.context.scene)
	

def unregister():
	bl_场景管理.unregister()
	ui_场景数据子面板.unregister()

	for c in classes:
		bpy.utils.unregister_class(c)

	


